package com.sskj.mine;

import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.Response;
import com.lzy.okrx2.adapter.FlowableBody;
import com.sskj.common.base.HttpData;
import com.sskj.lib.bean.PageBean;
import com.sskj.lib.http.JsonCallBack;
import com.sskj.lib.http.JsonConverter;
import com.sskj.mine.bean.BuyRecordBean;
import com.sskj.mine.http.HttpConfig;
import com.sskj.mine.presenter.BasePresenter;

import java.util.ArrayList;
import java.util.List;

import io.reactivex.Flowable;

public class BuyRecordPresenter extends BasePresenter<BuyRecordFragment> {
    public  Flowable<List<BuyRecordBean>> getBuyRecordList(int p,int size) {
       return OkGo.<HttpData<PageBean<BuyRecordBean>>>post(HttpConfig.BASE_URL + HttpConfig.IN_RECORD)
                .params("page", p)
                .params("size", size)
                .converter(new JsonConverter<HttpData<PageBean<BuyRecordBean>>>() {
                })
                .adapt(new FlowableBody<>())
                .map(i -> i.getData().getList());
    }
}
